unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, frxDesgn, frxClass, frxOLE, OleCtnrs, frxRich;

type
  TForm1 = class(TForm)
    frxReport1: TfrxReport;
    frxDesigner1: TfrxDesigner;
    Btnx_1: TButton;
    Btnx_2: TButton;
    frxOLEObject1: TfrxOLEObject;
    OleContainer1: TOleContainer;
    Btnx_3: TButton;
    frxRichObject1: TfrxRichObject;
    procedure Btnx_1Click(Sender: TObject);
    procedure Btnx_2Click(Sender: TObject);
    procedure frxReport1BeforePrint(Sender: TfrxReportComponent);
    procedure FormShow(Sender: TObject);
    procedure Btnx_3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Btnx_1Click(Sender: TObject);
begin
  Self.frxReport1.LoadFromFile(ExtractFilePath(ParamStr(0))+'00001.fr3');
  Self.frxReport1.ShowReport();
end;

procedure TForm1.Btnx_2Click(Sender: TObject);
begin
  Self.frxReport1.LoadFromFile(ExtractFilePath(ParamStr(0))+'00001.fr3');
  Self.frxReport1.DesignReport();
end;

procedure TForm1.frxReport1BeforePrint(Sender: TfrxReportComponent);
var
  OleView:TfrxOLEView;
  RichView:TfrxRichView;
begin
  OleView:=TfrxOLEView(frxReport1.FindObject('OLE1'));
  if OleView<>nil then
  begin
    OleView.OleContainer.CreateLinkToFile(ExtractFilePath(ParamStr(0))+'00003.doc',False);
  end;

  {RichView:=TfrxRichView(frxReport1.FindObject('Rich1'));
  if RichView <>nil then
  begin
    RichView.LoadFromStream();
  end;}
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  //self.OleContainer1.CreateObjectFromFile(ExtractFilePath(ParamStr(0))+'00003.doc',False);
end;

procedure TForm1.Btnx_3Click(Sender: TObject);
begin
  self.frxReport1.ShowReport();
end;

end.
